package cn.practice.chat.utils;

import com.alibaba.fastjson.JSONObject;

/**
 * @ClassName 用于解析
 * @Description:
 * @Author A-TAO
 * @Date 2022/10/31
 * @Version V1.0
 **/
public class  AnalysisUtil {

    /**
     * @description  用于解析username=zhangsan&password=131 之类的字段
     * @param data
     * @param objectClass
     * @return {@link T}
     **/
    public static <T> T stringAnalysis(String data, Class<T> objectClass){
        String newData ="{\""+ data.replace("&","\",\"").replace("=", "\":\"") +"\"}";
        T t1 = JSONObject.parseObject(newData, objectClass);
        return t1;
    }





}
